package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.MealDetailMapper;
import com.ruoyi.system.domain.MealDetail;
import com.ruoyi.system.service.IMealDetailService;

import javax.annotation.Resource;

/**
 * 套餐详情Service业务层处理
 *
 * @author ruoyi
 * @date 2024-08-30
 */
@Service
public class MealDetailServiceImpl implements IMealDetailService {
    @Resource
    private MealDetailMapper mealDetailMapper;

    /**
     * 查询套餐详情
     *
     * @param id 套餐详情主键
     * @return 套餐详情
     */
    @Override
    public MealDetail selectMealDetailById(Long id) {
        return mealDetailMapper.selectMealDetailById(id);
    }

    /**
     * 查询套餐详情列表
     *
     * @param mealDetail 套餐详情
     * @return 套餐详情
     */
    @Override
    public List<MealDetail> selectMealDetailList(MealDetail mealDetail) {
        return mealDetailMapper.selectMealDetailList(mealDetail);
    }

    /**
     * 新增套餐详情
     *
     * @param mealDetail 套餐详情
     * @return 结果
     */
    @Override
    public int insertMealDetail(MealDetail mealDetail) {
        mealDetail.setCreateTime(DateUtils.getNowDate());
        return mealDetailMapper.insertMealDetail(mealDetail);
    }

    /**
     * 修改套餐详情
     *
     * @param mealDetail 套餐详情
     * @return 结果
     */
    @Override
    public int updateMealDetail(MealDetail mealDetail) {
        mealDetail.setUpdateTime(DateUtils.getNowDate());
        return mealDetailMapper.updateMealDetail(mealDetail);
    }

    /**
     * 批量删除套餐详情
     *
     * @param ids 需要删除的套餐详情主键
     * @return 结果
     */
    @Override
    public int deleteMealDetailByIds(Long[] ids) {
        return mealDetailMapper.deleteMealDetailByIds(ids);
    }

    /**
     * 删除套餐详情信息
     *
     * @param id 套餐详情主键
     * @return 结果
     */
    @Override
    public int deleteMealDetailById(Long id) {
        return mealDetailMapper.deleteMealDetailById(id);
    }
}
